﻿#region File Description
/*-----------------------------------------------------------------------------
 Author: Jose Antonio Gallego
 Date: 24/10/2011
 
 License: Ms-PL
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.

 The example companies, organizations, products, domain names,
 e-mail addresses, logos, people, places, and events depicted
 herein are fictitious.  No association with any real company,
 organization, product, domain name, email address, logo, person,
 places, or events is intended or should be inferred.
-----------------------------------------------------------------------------*/
#endregion

using Microsoft.Phone.Controls;

namespace Zombsquare
{
    public partial class GuiadeUsoPage : PhoneApplicationPage
    {
        double initialAngle;
        double initialScale;

        public GuiadeUsoPage()
        {
            InitializeComponent();
        }
        private void OnTap(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
        {
            transform.TranslateX = transform.TranslateY = 0;
        }

        private void OnDoubleTap(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
        {
            transform.ScaleX = transform.ScaleY = 1;
        }

        private void OnHold(object sender, Microsoft.Phone.Controls.GestureEventArgs e)
        {
            transform.TranslateX = transform.TranslateY = 0;
            transform.ScaleX = transform.ScaleY = 1;
            transform.Rotation = 0;
        }

        private void OnDragStarted(object sender, DragStartedGestureEventArgs e)
        {
            //border.Background = greenBrush;
        }

        private void OnDragDelta(object sender, DragDeltaGestureEventArgs e)
        {
            transform.TranslateX += e.HorizontalChange;
            transform.TranslateY += e.VerticalChange;
        }

        private void OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            //border.Background = normalBrush;
        }

        private void OnPinchStarted(object sender, PinchStartedGestureEventArgs e)
        {
            //border.Background = redBrush;

            initialAngle = transform.Rotation;
            initialScale = transform.ScaleX;
        }

        private void OnPinchDelta(object sender, PinchGestureEventArgs e)
        {
            transform.Rotation = initialAngle + e.TotalAngleDelta;
            transform.ScaleX = transform.ScaleY = initialScale * e.DistanceRatio;
        }

        private void OnPinchCompleted(object sender, PinchGestureEventArgs e)
        {
            //border.Background = normalBrush;
        }

        private void OnFlick(object sender, FlickGestureEventArgs e)
        {
            //flickData.Text = string.Format("{0} Flick: Angle {1} Velocity {2},{3}",
            //    e.Direction, Math.Round(e.Angle), e.HorizontalVelocity, e.VerticalVelocity);
        }
    }
}
